﻿using Gym.Application.Common.Interfaces;
using Gym.Domain.RoomAggregate.Events;
using MediatR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gym.Application.Sessions.Events
{
    public class SessionScheduledEventHandler : INotificationHandler<SessionScheduledEvent>
    {
        private readonly ISessionsRepository _sessionsRepository;

        public SessionScheduledEventHandler(ISessionsRepository sessionsRepository)
        {
            _sessionsRepository = sessionsRepository;
        }

        public async Task Handle(SessionScheduledEvent notification, CancellationToken cancellationToken)
        {
            await _sessionsRepository.AddSessionAsync(notification.Session);
        }
    }
}
